package o;

import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import com.huawei.appmarket.service.alarm.control.RepeatingTaskReceiver;
import java.security.SecureRandom;

public class dhf extends AsyncTask<Void, Void, Void> {
    private Context ˊ;

    protected /* synthetic */ Object doInBackground(Object[] objArr) {
        return ˊ((Void[]) objArr);
    }

    public dhf(Context context) {
        this.ˊ = context;
    }

    protected Void ˊ(Void... voidArr) {
        if (System.currentTimeMillis() - dhg.ˎ().ॱ() >= dss.ॱ().ॱᐝ()) {
            try {
                Thread.sleep(edl.ˏ().ˋˊ());
            } catch (InterruptedException e) {
                Logger.ˋ("EntranceCheckTask", "sleep break");
            }
            try {
                try {
                    Thread.sleep(((long) new SecureRandom().nextInt(((int) edl.ˏ().ˌ()) / 1000)) * 1000);
                } catch (InterruptedException e2) {
                    Logger.ˋ("EntranceCheckTask", "sleep break");
                }
            } catch (IllegalArgumentException e3) {
                Logger.ˋ("EntranceCheckTask", "can not get random int IllegalArgumentException");
            } catch (Exception e4) {
                Logger.ˋ("EntranceCheckTask", "can not get random int Exception");
            }
            if (dhq.ॱ().ˎ()) {
                int ˊ = edp.ˊ();
                if (ˊ < edl.ˏ().ˋ()) {
                    edj ˋ = edh.ˋ(this.ˊ);
                    if (ˋ.ॱ || ˋ.ˎ > edl.ˏ().ॱॱ()) {
                        Logger.ˎ("EntranceCheckTask", "start main process");
                        Intent intent = new Intent(this.ˊ.getApplicationContext(), RepeatingTaskReceiver.class);
                        intent.putExtra(RepeatingTaskReceiver.REPEATING_TASK_TYPE, 18);
                        this.ˊ.sendBroadcast(intent);
                        dhg.ˎ().ˏ();
                    } else {
                        Logger.ˎ("EntranceCheckTask", "invalid entrance, battery too low: " + ˋ.ˎ);
                    }
                } else {
                    Logger.ˎ("EntranceCheckTask", "invalid entrance, cpu usage is too high: " + ˊ);
                }
            } else {
                Logger.ˎ("EntranceCheckTask", "not agree protocol");
            }
        } else {
            Logger.ˋ("EntranceCheckTask", "invalid entrance too frequent");
        }
        return null;
    }
}
